package com.ls.pattern.decorator.demo;

import java.util.List;

/**
 * 会员折扣装饰器
 */
public class PriceVipDiscountDecorator extends PriceCalculateDecorator {

    public PriceVipDiscountDecorator(PriceCalculate priceCalculate) {
        super(priceCalculate);
    }

    @Override
    public Long discountPrice(List<Product> products) {
        Long originPrice = priceCalculate.calculatePrice(products);
        // 会员九折（此处为简化，实际应该从会员服务获取会员折扣）
        return originPrice * 9 / 10;
    }
}
